# Maintainer: Ivan Semkin (ivan at semkin dot ru)

pkgname=system-settings-git
_pkgname=system-settings
pkgver=r7160.26e4f74d
pkgrel=2
pkgdesc='System Settings application for Unity8'
url='https://github.com/ubports/system-settings'
arch=(x86_64 i686 armv7h aarch64)
license=(GPL3)
conflicts=(system-settings)
provides=(system-settings)
depends=(trust-store-git click-git gnome-desktop ubuntu-app-launch-git geonames-git libqtdbusmock-git ubuntu-ui-toolkit-git gsettings-qt-git accountsservice-ubuntu upower ubuntu-themes qmenumodel-git libqofono content-hub-git)
makedepends=(git cmake intltool)
checkdepends=(xorg-server-xvfb)
source=('git+https://github.com/ubports/system-settings.git')
sha256sums=('SKIP')

BUILDENV+=('!check') # Some tests fail

pkgver() {
  cd ${_pkgname}
  echo "r$(git rev-list --count HEAD).$(git describe --always)"
}

prepare() {
  cd ${_pkgname}
  git checkout bionic

  sed -i 's/update.cpp//g' plugins/system-update/CMakeLists.txt
  sed -i 's/apt-pkg//g' plugins/system-update/CMakeLists.txt
  sed -i 's/apt-pkg//g' tests/mocks/Ubuntu/SystemSettings/Update/CMakeLists.txt
  echo 'message("No updates sorry")' > tests/plugins/system-update/CMakeLists.txt
}

build() {
  cd ${_pkgname}
  mkdir -p build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR="lib/" ..
  make
}

check() {
  cd ${_pkgname}/build
  make ARGS+="--output-on-failure" test
}

package() {
  cd ${_pkgname}/build
  make DESTDIR="${pkgdir}/" install
}
# vim:set ts=2 sw=2 et:
